package com.web.controller.api;

import com.web.annotation.UserAccess;
import com.web.dao.FeedbackMapper;
import com.web.domain.ApiResponse;
import com.web.entity.Feedback;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;

/**
 * @author FDjavaone
 * @date 2017/8/22
 */

@RestController
@RequestMapping("api")
public class FeedbackController {

    @Autowired
    private FeedbackMapper feedbackMapper;


    /**
     * 意见提交
     */
    @UserAccess
    @RequestMapping("/app/feedback/submit")
    public ApiResponse editHeadImg(Feedback feedback, HttpServletRequest req, HttpServletResponse resp) {
        ApiResponse response = new ApiResponse();
        Date date = new Date();
        feedback.setCreateTime(date);
        feedback.setModifyTime(date);
        feedbackMapper.insertSelective(feedback);
        response.setMessage("意见提交成功！");
        response.setStatus(900000);
        return response;
    }
}
